package com.example.demo.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;

@RestController
@RequestMapping("/user")
public class UseController {


    @RequestMapping("/getuser")
    public String getUser() {
        System.out.println("执行 get User");
        return "get user";
    }

    @RequestMapping("/login")
    public String login() {
        Object obj = null;
        obj.hashCode();
        System.out.println("执行力 login");
        return "login";
    }
    @RequestMapping("/reg")
    public String reg() {
        int num = 10/0;
        System.out.println("执行力 reg");
        return "reg";
    }

    @RequestMapping("/getnum")
    public Integer getNumber() {
        return new Random().nextInt(10);
    }
}
